package cn.edu.tjufe.llp.tin.model.sys;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import cn.edu.tjufe.llp.tin.model.BaseEntity;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "sys_role", 
  indexes = {@Index(columnList = "name, deleted", name = "ux_sys_role_name", unique = true)}, 
  uniqueConstraints = {@UniqueConstraint(columnNames = { "name", "deleted" }, name = "uc_sys_role_name") })
public class SysRole extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2416550544662504514L;

	@Column(nullable=false, length=32)
	private String name;
	
	@Column(nullable=false, length=32)
	private String display;

	@Column(nullable=false, length=64)
	private String descr;
	
	@ManyToMany(mappedBy="roles")
    public Set<SysUser> users = new HashSet<>(0);	

}
